﻿
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[sproc_Flow_UpdateStep_V2]') AND type in (N'P', N'PC'))
    DROP PROCEDURE [dbo].[sproc_Flow_UpdateStep_V2];
GO
CREATE PROCEDURE [dbo].[sproc_Flow_UpdateStep_V2]
    @FlowID int,
    @StepID int,    
    @StepName nvarchar(300),
    @StepRemark nvarchar(max),
    @RightToFinish bit,
    @FlowRule int,
    @PassNum int = 0,
    @LocalAlert bit =0,
    @BaseHour int = 0,
    @CycTimes int = 0,
    @Period int = 0
AS
BEGIN
SET NOCOUNT ON;

UPDATE
    dbo.UDS_Flow_Step 
SET
    Step_Name = @StepName,
    Step_Remark = @StepRemark,
    RightToFinish = @RightToFinish,
    Flow_Rule = @FlowRule,
    PassNum = @PassNum,
    LocalAlert = @LocalAlert,
    BaseHour = @BaseHour,
    CycTimes = @CycTimes,
    Period = @Period
WHERE     
    flow_id = @flowid 
    and step_id = @stepid;

IF ( @@rowcount = 1 )
    return 0;

return -1;

END
GO